<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>练习</title>
    <script src="static\js\jquery-3.7.1.min.js"></script>
</head>
<style>
    .current{
        background-color: red;
    }
</style>
<body>
    <p>添加类</p>
    <span class="current">删除类</span>
    <div class="current">切换类</div>
    <script>
        $("p").click(function(){
            $(this).addClass("current")
            //$(this).addClass("currentcurrentl")
        });
        $("span").click(function(){
            $(this).removeClass("current")
            //$(this).removeClass("currentcurrentl")
        });
        $("div").click(function(){
            $(this).toggleClass("current")
        });
    </script>
</body>
</html>